using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Acms.WebControls
{
    [PersistChildren(true)]
    [ParseChildren(false)]
    [ToolboxData("<{0}:FixedWidthColumn Width=\"\" runat=server></{0}:FixedWidthColumn>")]
    [Designer(typeof(FixedWidthColumnDesigner))]
    public class FixedWidthColumn : BaseColumn
    {
        public enum FloatOptions
        {
            Left,
            Right
        }

        private FloatOptions _Float = FloatOptions.Left;

        public FloatOptions Float
        {
            get { return _Float; }
            set { _Float = value; }
        }

        internal override int GetColumnWidth()
        {
            return 1;
        }

        protected override string GetClass()
        {
            if (Float == FloatOptions.Left)
            {
                return "FixedWidthLeft";
            }
            else
            {
                return "FixedWidthRight";
            }
    
        }

        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            if (this.Width != null && !this.Width.IsEmpty)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Width, this.Width.ToString());
            }
        }
    }

    public class FixedWidthColumnDesigner : BaseColumnDesigner
    {
        public override string FrameCaption
        {
            get { return "Acms Fixed Width Column"; }
        }
    }
}